Skip to content

Master CI failure#60

Merged
Demonstrandum merged 4 commits into
masterfrom
cursor/master-ci-failure-2ed4
Feb 20, 2026
Merged

Master CI failure#60
Demonstrandum merged 4 commits into
masterfrom
cursor/master-ci-failure-2ed4

Conversation

@Demonstrandum

Copy link
Copy Markdown
Owner

Motivation for features / changes

This PR fixes a critical CI failure on master (TypeError: Cannot read property 'settings' of undefined) that occurred after merging PR #58. The failure was caused by a race condition and missing NgRx feature state in certain test environments, specifically when RunsEffects and FeatureFlagEffects were initialized without the SettingsModule being loaded.

Technical description of changes

  1. settings_selectors.ts: The selectSettingsState feature selector is now wrapped with createSelector to provide initialState as a fallback. This prevents crashes when the settings feature state is accessed before its module is registered, aligning with standard NgRx patterns.
  2. colorScale.ts: The ColorScale component, which was updated in PR Run selection persistence #58 to depend on window.__tbRunColorMap (seeded by an NgRx effect), is made more resilient to timing issues.
    • readColorMap() now returns null if window.__tbRunColorMap is not yet available, instead of throwing an error.
    • setDomain() falls back to the original static color palette when window.__tbRunColorMap is null. If the map is present but a run is missing, a console.error is logged to indicate a potential bug.
    • getColor() continues to throw an error if a run is requested that is not in the domain, ensuring actual programming errors are not silently swallowed.

Screenshots of UI changes (or N/A)

N/A

Detailed steps to verify changes work correctly (as executed by you)

  1. Identified the CI failure on master (TypeError: Cannot read property 'settings' of undefined and setFeatureFlags of undefined) after PR Run selection persistence #58 merge.
  2. Traced the settings error to getRunColorMap selector chain evaluating before SettingsModule was registered in test contexts.
  3. Applied the fix to settings_selectors.ts to provide initialState fallback.
  4. Traced the setFeatureFlags error and colorScale.ts issues to race conditions where Polymer elements or window.__tbRunColorMap were not ready when accessed.
  5. Refactored colorScale.ts to gracefully handle window.__tbRunColorMap not being seeded yet, falling back to static palette, while still throwing for actual missing runs.
  6. Verified that console.error in setDomain would not cause test failures but would highlight real bugs in production.
  7. Confirmed that the changes address the identified root causes and restore correct behavior in affected test environments.

Alternate designs / implementations considered (or N/A)

Initially, a more aggressive error silencing approach was considered for colorScale.ts (e.g., returning a default color from getColor if a run was not found). However, this was reverted in favor of a more robust solution that distinguishes between legitimate timing issues (falling back to a static palette) and actual programming errors (throwing from getColor or logging console.error for missing runs when the map is expected to be ready). This ensures that real bugs are not silently hidden.


Open in Web Open in Cursor 

cursoragent and others added 3 commits February 20, 2026 18:03
The syncPolymerRunColorMap$ effect (added in PR #58) uses
getRunColorMap which transitively depends on the settings feature
selector via getColorPalette. In the karma bundle test, when the
settings feature state is not registered in a particular test's
MockStore, selectSettingsState returns undefined, causing
'TypeError: Cannot read property settings of undefined' in the
memoized selector chain.

Fix 1 - settings_selectors.ts: Wrap the bare createFeatureSelector
with a createSelector that falls back to initialState when the
feature state is undefined. This prevents crashes in any test that
evaluates settings-dependent selectors without registering the
settings feature.

Fix 2 - colorScale.ts: The readColorMap() function threw when
window.__tbRunColorMap was not set. During tests and before the
first NgRx effect fires, this map is absent. Changed to return
null gracefully, skip domain population when the map is absent,
and return a neutral fallback color (#808080) from getColor
instead of throwing when a run is not in the domain.

Co-authored-by: Samuel <samuel@knutsen.co>
Revert the overly-defensive approach. When window.__tbRunColorMap is
not yet seeded (race between runsStore listener and the NgRx effect),
fall back to the original static palette assignment so the domain is
always fully populated and getColor throws for actual programming
errors. When the shared color map IS available but a run is missing,
log console.error so the problem is visible.

Co-authored-by: Samuel <samuel@knutsen.co>
When the shared color map exists but is missing a specific run,
fall back to the palette color for that entry (and log the error).
Previously the identifier was set to undefined, which would cause
getColor to return undefined instead of a hex string.

Co-authored-by: Samuel <samuel@knutsen.co>
@cursor

cursor Bot commented Feb 20, 2026

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@Demonstrandum Demonstrandum marked this pull request as ready for review February 20, 2026 18:14
@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown

Preview Deployment

Status ✅ Running
Live Preview https://Demonstrandum-tensorbored-pr-60.hf.space
Space https://huggingface.co/spaces/Demonstrandum/tensorbored-pr-60
Details
  • Wheel: tensorbored_nightly-2.21.0a20260220-py3-none-any.whl
  • Commit: 3be33aa
  • Build status: success

Co-authored-by: Samuel <samuel@knutsen.co>
@Demonstrandum Demonstrandum merged commit 3b3248a into master Feb 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants